Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic docker files #45

Merged
merged 7 commits into from
Nov 8, 2024
Merged

basic docker files #45

merged 7 commits into from
Nov 8, 2024

Conversation

nickbristow
Copy link
Collaborator

Adds basic docker files for dev and prod

@nickbristow nickbristow marked this pull request as ready for review November 7, 2024 21:33
Dockerfile.prod Outdated Show resolved Hide resolved
Comment on lines +36 to +39
# Copy the built artifacts from the builder stage
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good! I was inspecting the container's files and I'm not seeing anything I wouldn't expect.
image

next.config.js Outdated
@@ -4,15 +4,15 @@ const path = require('path');
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: 'export',
output: 'standalone',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is breaking the CI checks since we're no longer producing an out directory containing the static files.

Should we leave it as export unless building within a Docker image? Or update CI to handle a standalone build?

image

Dockerfile Outdated
Comment on lines 7 to 9
RUN npm install

COPY . .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's important to note here that since we're copying files from our local machines into the image (rather than sharing the files between host and container) we won't be able to do things like install new packages as we're working without rebuilding/rerunning the container after we make a change. Files also won't fast refresh in the browser as we work since the files are being copied rather than shared.

I think we have two options:

  1. Rework this image and/or use docker compose for local development so we can share files between host and container (in my experience, this can create its own set of issues)
  2. Forget using Docker for local dev work, only keep Docker files needed for the prod build, and continue to work locally

What do you think? Personally, I'd most likely continue to work locally whether we have a local dev Docker setup or not since it's been very painless for me so far, so I'd say it's up to you on whether or not you think it's worth putting some effort into.

package.json Outdated Show resolved Hide resolved
@nickbristow nickbristow merged commit 59ae65e into next Nov 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants